package com.cs.study.homework._0302;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class Demo2 {
    public static void main(String[] args) {
        FileOutputStream stream = null;
        try {
            stream = new FileOutputStream("E:\\a\\b.txt");
            stream.write("1234".getBytes());
        } catch (FileNotFoundException e) {
            System.out.println("未找到该文件");
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            try {
                if (stream != null) {
                    stream.close();
                }
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
